package biz.obake.team.touchprotector.notice;

import biz.obake.team.touchprotector.g.a;
import biz.obake.team.touchprotector.g.c;

public final class InAppUpdateNotice extends ClosableNotice implements c.b {
    private final String PREF_VERSION_SUFFIX = "_version";

    public InAppUpdateNotice() {
        c.e(this);
    }

    private final boolean isUpdateAvailable() {
        return d.h.b.c.a("UpdateAvailable", c.c("InAppUpdate.State"));
    }

    private final String updateVersionCode() {
        String c2 = c.c("InAppUpdate.VersionCode");
        d.h.b.c.b(c2, "RamPrefs.getString(InAppUpdateFeature.VersionCode)");
        return c2;
    }

    /* access modifiers changed from: protected */
    public void close() {
        a.p("notice_" + this.mGuid + "_closed", true);
        a.r("notice_" + this.mGuid + this.PREF_VERSION_SUFFIX, updateVersionCode());
    }

    public final String getPREF_VERSION_SUFFIX() {
        return this.PREF_VERSION_SUFFIX;
    }

    public boolean isAlerted() {
        if (isUpdateAvailable()) {
            return super.isAlerted();
        }
        return false;
    }

    /* access modifiers changed from: protected */
    public boolean isClosed() {
        if (!a.g("notice_" + this.mGuid + "_closed")) {
            return false;
        }
        return d.h.b.c.a(a.l("notice_" + this.mGuid + this.PREF_VERSION_SUFFIX), updateVersionCode());
    }

    public boolean isVisible() {
        if (isUpdateAvailable()) {
            return super.isVisible();
        }
        return false;
    }

    /* access modifiers changed from: protected */
    public void onPrefChanged(String str) {
        if (!d.h.b.c.a(str, "notice_" + this.mGuid + "_closed")) {
            if (!d.h.b.c.a(str, "notice_" + this.mGuid + this.PREF_VERSION_SUFFIX)) {
                return;
            }
        }
        update();
    }

    public void onRamPrefsChanged(String str) {
        d.h.b.c.c(str, "key");
        if (d.h.b.c.a("InAppUpdate.State", str)) {
            update();
        }
    }
}
